<!-- 个人信息/基本资料 -->
<template>
	<view class="basicInformation">
	     <view class="flex-start-center">
	     	<view class="line">

	     	</view>
	     	<view class="">
	     		个人信息
	     	</view>
	     </view>
		<view class="myNmae flex-between">
			<text style="min-width: 50rpx;">姓名</text>
			<input class="font-overflow" v-model="form.technicianName" placeholder="请输入姓名" />
		</view>
		<view class="myNmae flex-between">
			<text style="min-width: 50rpx;">电话</text>
			<input maxlength="11" type="number" v-model="form.mobile" placeholder="请输入联系方式" />
		</view>
		
		
		<view class="flex-between myNmae">
			<text>您的性别</text>
			<radio-group v-model="form.gender" name="apply" @change="handleApplyType">
				<label class="m-right10">
					<radio :checked="form.gender ==1" class="min-radio"  color="#67C23A" />
					<text>男</text>
				</label>
				<label>
					<radio :checked="form.gender ==2" class="min-radio" color="#67C23A" />
					<text>女</text>
				</label>
			</radio-group>
		</view>

		<view class="flex-between myNmae">
			<text style="width: 200rpx;">您的年龄</text>
			<input type="number" maxlength="3" v-model="form.age" placeholder="请输入年龄" />
		</view>
		<view class="myNmae flex-between">
			<text>从业时间</text>
			<picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
				<view class="flex-align-center color6" v-if="yeartime">
					{{ yeartime }}
					<text>-</text>
					{{ monthtime }}
					<text>-</text>
					{{ daytime }}
				</view>
				<view class="flex-align-center color6" v-else>请选择从业时间</view>
			</picker>
			<!-- <text>请选择从业时间</text> -->
		</view>



		<view class="sumbit-btn flex" >确定并绑定</view>

	</view>
</template>

<script>
	import {

		mapMutations
	} from 'vuex'
	import {
		mapState
	} from 'vuex'
	import {
		mapGetters
	} from 'vuex'
  import citySel from '@/components/city-sel/city-sel.vue'
	export default {

		components: {
			citySel
		},
		data() {
			const currentDate = this.getDate({
				format: true
			});
			return {
				form: {

					technicianName: '', //姓名
					gender: 1, //性别
					address: '', //详细地址
					mobile: '', //电话
					city: '', //城市
					age: '', //年龄
					// 从业时间end
					employmentTime: '',
					personalLntroduction: '', //个人介绍
					lifePhotos: '',
					label: '', // 个人标签——多个以逗号间隔
				},

				addValue: '',
				singleLabel: '', // 单个标签覆盖
				//添加标签数据
				tagAddList: [],
				//选择的年份
				yeartime: currentDate.split('-')[0],
				//选择的月份
				monthtime: currentDate.split('-')[1],
				//选择的天数
				daytime: currentDate.split('-')[2],
				date:null




			};
		},
		onLoad() {
			// this.$nextTick(() => {
			// 	this.$refs.citys.getCate();
			// });

		},
		computed: {
			startDate() {
				return this.getDate('start');
			},
			endDate() {
				return this.getDate('end');
			},


		},
		methods: {


			getCity(e) {
				console.log('获取城市的文字===', e);
				this.form.city = e;
			},

			// 选择日期
			bindDateChange: function(e) {
				this.date = e.target.value;
				/* 在上面声明变量，split是用来截取字段*/
				this.yeartime = this.date.split('-')[0];
				this.monthtime = this.date.split('-')[1];
				this.daytime = this.date.split('-')[2];
			},
			// 日期获取
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();
				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}

				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},

		}
	};
</script>

<style lang="less">
	page {
		background-color: #ffffff;
	}

	.basicInformation {
		padding: 50rpx 34rpx 50rpx;
        .line{
			width: 8rpx;
			height: 30rpx;
			background: rgb(54, 97, 255);
			margin-right: 15rpx;
		}
		.myNmae {
			padding: 34rpx 0;
			background-color: #fff;
			min-width: 50rpx;
            .avatar{
				width: 84rpx;
				height: 84rpx;
			}
			input {
				text-align: right;
			}
		}

		.personalLntroduction {
			.textarea-box {
				margin-top: 24rpx;
				border: 2rpx dashed #1e6ceb;
				background: #fff;
				padding: 30rpx;
				border-radius: 20rpx;

				.textarea-color {
					text-align: right;
					color: #999;
				}
			}

			.sunui-pop-main {
				z-index: 900;
			}

			.describe {
				margin-left: 10rpx;
				color: #666;
				font-size: 14px;
			}

			margin-top: 50rpx;
		}

		.personalTags {
			margin: 36rpx 0;

			.tag_container {
				margin-top: 36rpx;
				display: flex;
				align-items: center;
				flex-direction: row;
				// justify-content: space-between;
				flex-wrap: wrap;
			}

			.zy_tag_add {
				width: 150rpx;
				height: 50rpx; //medium：45rpx；small：40rpx；mini：35rpx
				padding: 5rpx 15rpx;
				margin: 5rpx 8rpx;
				// border: 1rpx solid $zy-classic-grey;
				border-radius: 10rpx;
				text-align: center;
			}
		}

		.sumbit-btn {
			width: 92%;
			height: 100rpx;
			color: #ffffff;
			border-radius: 50rpx;
			
			background: linear-gradient(82.57deg, rgb(254, 231, 184) 1.895%,rgb(244, 211, 150) 93.739%);
			position: fixed;
			bottom: 50rpx;
		}

		// “添加标签” 弹出框
		.v-pop-cls {
			padding: 46rpx 0 88rpx;
			width: 710rpx;
			height: auto;
			position: relative;
			border-radius: 20rpx;
			background: #fff;

			image {
				width: 52rpx;
				height: 52rpx;
				position: absolute;
				padding: 30rpx;
				top: 0rpx;
				right: 0rpx;
			}

			text {
				color: #000;
				font-size: 36rpx;
			}

			input {
				// text-align: center;
				padding: 0 20rpx;
				width: 608rpx;
				height: 94rpx;
				margin: 62rpx 0;
				border-radius: 20rpx;
				background: #f5f5f5;
			}

			view {
				width: 638rpx;
				height: 88rpx;
				background: #1890ff;
				color: #fff;
				font-size: 32rpx;
			}
		}
	}
</style>